﻿@inject LayoutDataServices data
@using WqLunTan.Controllers

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    var categories = ViewData["categories"] as List<CategoryAricleExt>;
    var hot = ViewData["hot"] as List<article_hot>;
    var forecast = ViewData["forecast"] as List<article_forecast>;
}

@section styles{
    <link href="~/css/index.css" rel="stylesheet" />
}

@*上面内容的两个分类*@
<div class="container-fluid">
    <div class="row">
        <div class="col-md-6 h4">
            <span>置顶</span>
        </div>
        <div class="col-md-6 h4">
            <div class="text-left"><a href="@Url.Action("list", "divination")" target="_blank">预测历史</a></div>
        </div>
    </div>

    <div class="row">

        @*文章分类编号1*@
        <div class="col-md-6" style="min-height:175px;">
            <ul>
                @{
                    if (hot != null && hot.Count > 0)
                    {
                        foreach (var item in hot)
                        {
                            <li><a style="color:#551A8B;font-size:16px;" href="@item.url" target="_blank">@item.title</a></li>
                        }
                    }
                    else
                    {
                        <li style="color:#551A8B;height:100%;line-height:100%;">N/A</li>
                    }
                }
            </ul>
        </div>

        @*预测历史*@
        <div class="col-md-6">
            <ul>
                @{
                    if (forecast != null && forecast.Count > 0)
                    {
                        foreach (var item in forecast)
                        {
                            <li style="cursor:pointer;color:chocolate;" onclick="javascript: window.open('@Url.Action("detail","divination",new { id = item.id})','_blank')">
                                <div class="row" title="@item.horoscope_8char">
                                    <div class="col-md-8">@item.title</div>
                                    <div class="col-md-4">@item.create_time.ToLocalTime().ToString("MM-dd HH:mm")</div>
                                </div>
                            </li>
                        }
                    }
                    else
                    {
                        <li style="color:#551A8B;">N/A</li>
                    }
                }
            </ul>
        </div>
    </div>

</div>
@*热门和预测结束部分*@


@*文章分类*@
<div class="container-fluid aricle_box">

    @*分类1和2*@
    <div class="row article_title">
        <div class="col-md-6 h4">
            <div class="row">
                <div class="col-md-6 text-left">
                    @{
                        var cate = categories.FirstOrDefault();
                        if (cate != null)
                        {
                            <a href="@Url.Action("list","article",new { id = cate.id })" target="_blank">@cate.category_name</a>
                        }
                        else
                        {
                            <span>分类名称1</span>
                        }
                    }
                </div>
            </div>
        </div>
        <div class="col-md-6 h4">
            <div class="row">
                <div class="col-md-6 text-left">
                    @{
                        var cate2 = categories.Skip(1).Take(1).FirstOrDefault();
                        if (cate2 != null)
                        {
                            <a href="@Url.Action("list","article",new { id = cate2.id })" target="_blank">@cate2.category_name</a>
                        }
                        else
                        {
                            <span>分类名称2</span>
                        }
                    }
                </div>
            </div>
        </div>
    </div>

    @*分类1*@
    <div class="row article_list" style="min-height:236px;">
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-12">
                    <ul style="color:#551A8B;">
                        @{
                            if (cate != null)
                            {
                                var artList = cate.artlist;
                                if (artList != null && artList.Count > 0)
                                {
                                    foreach (var item in artList)
                                    {
                                        <li><a style="color:#551A8B;font-size:16px;" href="@Url.Action(nameof(ArticleController.Detail).ToLower(), "article",new { id = item.id})" target="_blank">@item.title</a></li>
                                    }
                                }
                                else
                                {
                                    <li>N/A</li>
                                }
                            }
                            else
                            {
                                <li>N/A</li>
                            }
                        }
                    </ul>
                </div>
            </div>
        </div>

        @*分类2*@
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-12">
                    <ul style="color:#551A8B;">
                        @{
                            if (cate2 != null)
                            {
                                var artList = cate2.artlist;
                                if (artList != null && artList.Count > 0)
                                {
                                    foreach (var item in artList)
                                    {
                                        <li><a style="color:#551A8B;font-size:16px;" href="@Url.Action(nameof(ArticleController.Detail).ToLower(), "article",new { id = item.id})" target="_blank">@item.title</a> </li>
                                    }
                                }
                                else
                                {
                                    <li>N/A</li>
                                }
                            }
                            else
                            {
                                <li>N/A</li>
                            }
                        }
                    </ul>
                </div>

            </div>
        </div>
    </div>

</div>


@*文章分类*@
<div class="container-fluid aricle_box">

    @*分类3和4*@
    <div class="row h4 article_title">
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-6">

                    @{
                        var cate3 = categories.Skip(2).Take(1).FirstOrDefault();
                        if (cate3 != null)
                        {
                            <a href="@Url.Action("list","article",new { id = cate3.id })" target="_blank">@cate3.category_name</a>
                        }
                        else
                        {
                            <span>分类名称3</span>
                        }
                    }
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-6">
                    @{
                        var cate4 = categories.Skip(3).Take(1).FirstOrDefault();
                        if (cate4 != null)
                        {
                            <a href="@Url.Action("list","article",new { id = cate4.id })" target="_blank">@cate4.category_name</a>
                        }
                        else
                        {
                            <span>分类名称4</span>
                        }
                    }
                </div>
            </div>
        </div>
    </div>

    @*标题列表*@
    <div class="row article_list" style="min-height:200px;">

        @*分类3*@
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-12">
                    <ul style="color:#551A8B;">
                        @{
                            if (cate3 != null)
                            {
                                var artList = cate3.artlist;
                                if (artList != null && artList.Count > 0)
                                {
                                    foreach (var item in artList)
                                    {
                                        <li><a style="color:#551A8B;font-size:16px;" href="@Url.Action(nameof(ArticleController.Detail).ToLower(), "article",new { id = item.id})" target="_blank">@item.title</a> </li>
                                    }
                                }
                                else
                                {
                                    <li>N/A</li>
                                }
                            }
                            else
                            {
                                <li>N/A</li>
                            }
                        }
                    </ul>
                </div>
            </div>
        </div>

        @*分类4*@
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-12">
                    <ul style="color:#551A8B;">
                        @{
                            if (cate4 != null)
                            {
                                var artList = cate4.artlist;
                                if (artList != null && artList.Count > 0)
                                {
                                    foreach (var item in artList)
                                    {
                                        <li><a style="color:#551A8B;font-size:16px;" href="@Url.Action(nameof(ArticleController.Detail).ToLower(), "article",new { id = item.id})" target="_blank">@item.title</a> </li>
                                    }
                                }
                                else
                                {
                                    <li>N/A</li>
                                }
                            }
                            else
                            {
                                <li>N/A</li>
                            }
                        }
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>


@*文章分类*@
<div class="container-fluid aricle_box">

    @*分类5和6*@
    <div class="row h4 article_title">
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-6">
                    @{
                        var cate5 = categories.Skip(4).Take(1).FirstOrDefault();
                        if (cate5 != null)
                        {
                            <a href="@Url.Action("list","article",new { id = cate5.id })" target="_blank">@cate5.category_name</a>
                        }
                        else
                        {
                            <span>分类名称5</span>
                        }
                    }
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="row">
                <div class="col-md-6">
                    @{
                        var cate6 = categories.Skip(5).Take(1).FirstOrDefault();
                        if (cate6 != null)
                        {
                            <a href="@Url.Action("list","article",new { id = cate6.id })" target="_blank">@cate6.category_name</a>
                        }
                        else
                        {
                            <span>分类名称6</span>
                        }
                    }
                </div>
            </div>
        </div>
    </div>

    @*标题列表*@
    <div class="row article_list" style="min-height:270px;">

        <div class="col-md-6">
            <div class="row">
                <div class="col-md-12">
                    <ul style="color:#551A8B;">
                        @{
                            if (cate5 != null)
                            {
                                var artList = cate5.artlist;
                                if (artList != null && artList.Count > 0)
                                {
                                    foreach (var item in artList)
                                    {
                                        <li><a style="color:#551A8B;font-size:16px;" href="@Url.Action(nameof(ArticleController.Detail).ToLower(), "article",new { id = item.id})" target="_blank">@item.title</a> </li>
                                    }
                                }
                                else
                                {
                                    <li>N/A</li>
                                }
                            }
                            else
                            {
                                <li>N/A</li>
                            }
                        }
                    </ul>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-12">
                    <ul style="color:#551A8B;">
                        @{
                            if (cate6 != null)
                            {
                                var artList = cate6.artlist;
                                if (artList != null && artList.Count > 0)
                                {
                                    foreach (var item in artList)
                                    {
                                        <li><a style="color:#551A8B;font-size:16px;" href="@Url.Action(nameof(ArticleController.Detail).ToLower(), "article",new { id = item.id})" target="_blank">@item.title</a> </li>
                                    }
                                }
                                else
                                {
                                    <li>N/A</li>
                                }
                            }
                            else
                            {
                                <li>N/A</li>
                            }
                        }
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>